package com.hziee.cosmanage.member.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

//import org.apache.shiro.authz.annotation.RequiresPermissions;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import com.hziee.cosmanage.member.entity.CertificateEntity;
import com.hziee.cosmanage.member.service.CertificateService;
import com.hziee.common.utils.PageUtils;
import com.hziee.common.utils.R;



/**
 * 角色证书表
 *
 * @author yb
 * @email yangbin@gmail.com
 * @date 2021-02-02 22:48:30
 */
@RestController
@RequestMapping("member/certificate")
public class CertificateController {
    @Autowired
    private CertificateService certificateService;

    /**
     * 查看已录入的证书
     * @param userId
     * @return
     */
    @GetMapping("/getCertificates/{userId}")
    public R getCertificates(@PathVariable("userId") Integer userId){
        List<CertificateEntity> entity = certificateService.getCertificates(userId);
        if (entity!=null){
            return R.ok().put("data",entity);
        }else {
            return R.error("你还未录入证书");
        }
    }
//
//    /**
//     * 列表
//     */
//    @RequestMapping("/list")
//    //@RequiresPermissions("member:certificate:list")
//    public R list(@RequestParam Map<String, Object> params){
//        PageUtils page = certificateService.queryPage(params);
//
//        return R.ok().put("page", page);
//    }
//
//
//    /**
//     * 信息
//     */
//    @RequestMapping("/info/{certificateId}")
//    //@RequiresPermissions("member:certificate:info")
//    public R info(@PathVariable("certificateId") Integer certificateId){
//		CertificateEntity certificate = certificateService.getById(certificateId);
//
//        return R.ok().put("certificate", certificate);
//    }
//
//    /**
//     * 保存
//     */
//    @RequestMapping("/save")
//    //@RequiresPermissions("member:certificate:save")
//    public R save(@RequestBody CertificateEntity certificate){
//		certificateService.save(certificate);
//
//        return R.ok();
//    }
//
//    /**
//     * 修改
//     */
//    @RequestMapping("/update")
//   // @RequiresPermissions("member:certificate:update")
//    public R update(@RequestBody CertificateEntity certificate){
//		certificateService.updateById(certificate);
//
//        return R.ok();
//    }
//
//    /**
//     * 删除
//     */
//    @RequestMapping("/delete")
//    //@RequiresPermissions("member:certificate:delete")
//    public R delete(@RequestBody Integer[] certificateIds){
//		certificateService.removeByIds(Arrays.asList(certificateIds));
//
//        return R.ok();
//    }

}
